﻿/**
 * Jean-François Desgagné 2009 Portfolio
 * Copyright (c) 2009 Jean-François Desgagné <jfesgagne@gmail.com>
 * 
 * This work is licensed under a Creative Commons Attribution 3.0 United States License.
 * Some Rights Reserved.
 */
package com.jfdesgagne.jfdesgagne09.modules.showcase.view {
	import com.jfdesgagne.jfdesgagne09.common.PipeAwareModuleConstants;
	import com.jfdesgagne.jfdesgagne09.modules.showcase.ApplicationFacade;
	
	import org.puremvc.as3.multicore.interfaces.INotification;
	import org.puremvc.as3.multicore.utilities.pipes.interfaces.IPipeMessage;
	import org.puremvc.as3.multicore.utilities.pipes.messages.Message;
	import org.puremvc.as3.multicore.utilities.pipes.plumbing.Junction;
	import org.puremvc.as3.multicore.utilities.pipes.plumbing.JunctionMediator;
	import org.puremvc.as3.multicore.utilities.pipes.plumbing.Pipe;
	
	public class ShowcaseJunctionMediator extends JunctionMediator {
		public static const NAME:String = 'SimpleModuleJunctionMediator';
		
		public function ShowcaseJunctionMediator() {
			super(NAME, new Junction());
		}

		override public function onRegister():void {}
		
		override public function onRemove():void {
			this.junction.removePipe( PipeAwareModuleConstants.MODULE_SHELL_PIPE );
		}		
		
		override public function listNotificationInterests():Array {
 			var $interests:Array = super.listNotificationInterests();
				$interests.push(PipeAwareModuleConstants.PROGRESS_LOADING);
			return $interests; 
		}

		override public function handleNotification( note:INotification ):void {
			this.junction.sendMessage(PipeAwareModuleConstants.MODULE_SHELL_PIPE, new Message(note.getName(), null, note.getBody()));	
		}
		
	}
}